<form id="pagerForm" method="post" action="book/chart">
	<input type="hidden" name="pageNum" value="1" />
	<input type="hidden" name="numPerPage" value="{{psize}}" />
	<input type="hidden" name="orderField" value="id" />
	<input type="hidden" name="charge_type" value="{{charge_type}}" />
	<input type="hidden" name="platform_id" value="{{platform_id}}" />
	<input type="hidden" name="run_id" value="{{run_id}}" />
	<input type="hidden" name="plan_id" value="{{plan_id}}" />
	<input type="hidden" name="partner_id" value="{{partner_id}}" />
	<input type="hidden" name="version_name" value="{{version_name}}" />
	<input type="hidden" name="product_name" value="{{product_name}}" />
	<input type="hidden" name="date" value="{{date}}" />
	<input type="hidden" name="start" value="{{start}}" />
	<input type="hidden" name="book_ids" value="{{book_ids}}" />
</form>

<div class="pageHeader">
	<form onsubmit="return navTabSearch(this);" action="book/chart" method="post">
    {% module BasicQueryCond(platform_id,run_id,plan_id,partner_id,version_name,product_name,run_list,plan_list,date,start=start) %}
    <div class="searchBar">
        <table class="searchContent">
            <tr>
            <td>
            计费类型：<select name="charge_type">
                <option value="" {% if not charge_type %}selected{% end %}>不限</option>
                <option value="book" {% if charge_type == 'book' %}selected{% end %}>按本</option>
                <option value="chapter" {% if charge_type == 'chapter' %}selected{% end %}>按章</option>
            </select>
            </td>
            <td><a class="icon" href="book/chart?action=export" target="dwzExport" targettype="navTab" title="确实要导出这些记录吗?"><span>导出EXCEL</span></a></td>
            <td>
            书的ID：<input type="text" name="book_ids" size="60" value="{{book_ids}}"/>&nbsp;半角逗号分隔
            <td colspan="6"></td>
            <td> 
            </tr>
        </table>
	</form>
</div>

<script type="text/javascript">
$(function () {
    var chart;
      chart = new Highcharts.Chart({
          chart: {
              renderTo: 'container_book_single_chart',
              type: 'line',
              marginRight: 130,
              marginBottom: 25
          },
          title: {
              text: '单本数据',
              x: -20 //center
          },
          subtitle: {
              text: '按本数据',
              x: -20
          },
          xAxis: {
              categories: {{ x_axis }}
          },
          yAxis: {
              title: {
                  text: 'count'
              },
              plotLines: [{
                  value: 0,
                  width: 1,
                  color: '#808080'
              }]
          },
          tooltip: {
              crosshairs: true,
              shared: true
          },
          legend: {
              layout: 'vertical',
              align: 'right',
              verticalAlign: 'top',
              x: -10,
              y: 100,
              borderWidth: 0
          },
          series: [
          {% for idx,i in enumerate(results) %}
          {
              name: '{{ results[i]['title'] }}',
              {% if results[i]['title'] not in ('阅饼消费')%}
              visible:false,
              {% end %}
              data: [{{ results[i]['data'] }}]
          }{% if idx != len(results)-1 %},{%end%}
          {% end %}
          ]
      });
});
</script>

<div class="fixed" style="overflow:auto;height:420px;">
<div id="container_book_single_chart" style="min-width: 400px; height: 360px; margin: 0 auto 10px;"></div>

<div class="pageContent">
	<table class="table" width="100%" layoutH="108">
		<thead>
			<tr>
				<th align="center">时间</th>
				<th align="center">书ID</th>
				<th align="center">书名</th>
				<th align="center">作者</th>				
				<th align="center">版权</th>
                <th align="center">类别</th>
                <th align="center">子类</th>
                <th align="center">三级分类</th>
				<th align="center">计费类型</th>
				<th align="center">状态</th>
				<th align="center">月饼消费</th>
				<th align="center">付费下载数</th>
				<th align="center">付费下载用户数</th>
				<th align="center">免费下载数</th>
				<th align="center">免费下载用户数</th>
				<th align="center">简介访问数</th>
				<th align="center">简介访问人数</th>
				<th align="center">批量订购阅饼消费</th>
				<th align="center">批量订购PV</th>
				<th align="center">批量订购UV</th>
			</tr>
		</thead>
		<tbody>		
            {% for i in books%}
            <tr>
                <td>{{strftime_day(i['time'])}}</td><td>{{i['book_id']}}</td><td>{{i['name']}}</td>
                <td>{{i['author']}}</td><td>{{i['cp']}}</td>
                <td>{{i['category_2']}}</td><td>{{i['category_1']}}</td><td>{{i['category_0']}}</td>
                <td>{% if i.charge_type == 'book' %}按本{%else%}按章{%end%}</td>
                <td>{{i['state']}}</td>
                <td>{{i.fee}}</td>
                <td>{{i.pay_down}}</td><td>{{i.pay_user}}</td>
                <td>{{i.free_down}}</td><td>{{i.free_user}}</td><td>{{i.pv}}</td><td>{{i.uv}}</td>
                <td>{{i.batch_fee}}</td><td>{{i.batch_pv}}</td><td>{{i.batch_uv}}</td>
            </tr>
            {% end %}
		</tbody>
	</table>
    {% module Pagination(count,page,psize) %}
</div>

